isc-dhcp: fix startup issues with RFC-1918 PTR RRs
authorPhilip Prindeville <[email protected]>
Wed, 10 Dec 2025 22:03:41 +0000 (15:03 -0700)
committerPhilip Prindeville <[email protected]>
Sat, 13 Dec 2025 19:26:38 +0000 (12:26 -0700)
If isc-dhcp gets restarted, it might have to deal with RFC-1918 zones
being previously populated by an earlier instance.  In that case, we
need to know if we're modified versus initially adding the zones.

The special handling of RFC-1918 zones in Bind is quirky, and there
should be a patch soon to make it more friendly, but in the meantime
you might have to use:

disable-empty-zone 168.192.in-addr.arpa;

Or similar depending on which address block you poach.

Signed-off-by: Philip Prindeville <[email protected]>
net/isc-dhcp/Makefile
net/isc-dhcp/files/dhcpd.init

index c9eddf3a3ef98d4456ebf8e86ff81471e2d8ed98..86de3d67e287e7d160526233d01383e7dbe97e90 100644 (file)
@@ -11,7 +11,7 @@ PKG_NAME:=isc-dhcp
 UPSTREAM_NAME:=dhcp
 PKG_REALVERSION:=4.4.3-P1
 PKG_VERSION:=4.4.3_p1
-PKG_RELEASE:=13
+PKG_RELEASE:=14
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
index d7f24d9be02605bbb9a1172fd7f7b244f2f14859..6e1cb53f721d2ee5eeae383c01b4ab502508d66b 100755 (executable)
@@ -154,7 +154,7 @@ EOF
 }
 
 create_empty_zone() {
-       local zone error zpath
+       local zone error zpath command
        zone="$1"
        zpath="$dyndir/db.$zone"
 
@@ -167,7 +167,15 @@ create_empty_zone() {
        chown bind:bind "$zpath" || return 1
        chmod 0664 "$zpath" || return 1
 
-       if ! error=$(rndc modzone $zone "{
+       # if the zone doesn't exist, we need to add it, otherwise we need to
+       # create it.
+       if ! rndc zonestatus $zone >/dev/null 2>&1; then
+               command="addzone"
+       else
+               command="modzone"
+       fi
+
+       if ! error=$(rndc $command $zone "{
                type primary;
                file \"$zpath\";
                update-policy {